package com.heima.service.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import javax.sql.DataSource;

@Configuration
@ComponentScan("com.heima")
@PropertySource(value = "classpath:account.properties")
public class SpringConfig {


    @Bean("dataSource")
    public DruidDataSource dataSource() {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        dataSource.setPassword("1234");
        dataSource.setUrl("jdbc:mysql:///ssm");
        dataSource.setUsername("root");
        return dataSource;
    }
}
